using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace Evolution.Engine.Managers
{
    public class LogManager : Singleton<LogManager>
    {
        private string _FileName;

#if(!DEBUG)
        public bool Logging = false;
#endif

        public LogManager()
        {
            _FileName = "Run.log";

#if(DEBUG)
            Create(_FileName);
#endif
        }

        public void Create(string FileName)
        {
            System.IO.File.Delete(FileName);
            _FileName = FileName;
        }

        public void WriteLine(string line)
        {
#if(!DEBUG)
            if (Logging)
            {
#endif
                StreamWriter sr = new StreamWriter(_FileName, true);
                sr.WriteLine(line);
                sr.Close();
                sr = null;
#if(!DEBUG)
            }
#endif
        }
    }
}
